package panda.client.ui.observable;

import panda.client.engine.Observable;
import panda.client.ui.widgets.DraggableCard;

/**
 * Observable class that stores the last DraggableCard object that recieved a mouseEnter event.
 * 
 * @author zane.tian@gmail.com
 */
public class ObservableLastMousedCard extends Observable {
	DraggableCard card;

	public ObservableLastMousedCard() {
		card = null;
	}

	public boolean hasCard() {
		return !(card == null);
	}

	public DraggableCard getCard() {
		if(card == null) {
			throw new IllegalStateException("LastMousedCard doesn't contain a card.");
		} else
			return card;
	}

	public void setCard(DraggableCard card) {

		// System.out.println("[c] observablelastmousedcard - setting " + card);
		this.card = card;
		setChanged();
		notifyObservers();

		// CanvasLog.get().log("notifyObs in LastMousedCard triggered on: " + card.getName());
	}
}